[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
GOSUB LABEL
Function
Transfer program control to place marked by LABEL and save the current
location for a future RETURN statement (GO SUB is a synonym).
Syntax
GOSUB label
label - The label to which control should be transferred.
Remarks
It is often necessary to perform an indentical set of instructions
several times in a program. This leaves you with two choices. One,
rewrite the code several times (and hope you do it right each time), or
two, write it once as a subroutine, then use GOSUB to run it. This
statement will save the address of the next line so that a RETURN
at the end of the subroutine can instruct PPL to resume execution with
the line following the GOSUB.
Examples
STRING Question, Answer
LET Question = "What is your street address ..."
GOSUB ask
LET Question = "What is your city, state and zip ..."
GOSUB ask
END
:ask ' Subroutine to ask a question, get an answer, and log them to a file
LET Answer = ""
PRINTLN "@X0E",Question
INPUT "",Answer
NEWLINES 2
FPUTLN 0,"Q: ",STRIPATX(Question)
FPUTLN 0,"A: ",Answer
RETURN
See Also:
GOTO
RETURN
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson